{include file="common/head"}
<head>
<title>商品列表</title>

<style>
.form-control{width: initial;display: inline-block;}
</style>
</head>
<body >
<div class="container-fluid">

    <form action="/index.php/goods/index" method="post">
    <div class="row" id="query_bar" style="height: 50px;line-height: 50px;">
        <div class="col">
        <label for="table_id" >状态:
            <select id="status" name="status" class="form-control">
                <option value="">未选择</option>
                {foreach $status_arr as $k=>$v}
                    <option value="{$k}" {if $k==$status} selected {/if} >{$v}</option>
                {/foreach}
            </select>
        </label>
  

        <label for="name" >关键字：
            <input class="form-control" type="text" value="{$name}" id="name" name="name" placeholder="名称关键字" />
        </label>

        
        <button type="button" class="btn btn-warning query" style="vertical-align: middle;" >
            <span class="bi-search" ></span>
        </button>

    
        </div>

    </div>
    </form>

    <h2>培练项目维护</h2>
    <table class="table table-sm table-hover table-striped" style="width: 100%;">
        <thead style="">
            <th>序号</th>
            <th>名称</th>
            <th>价格</th>
            <th>优惠价格</th>
            <th>图片</th>            
            <th>录入人</th>        
            <th>录入时间</th>
            <th>是否启用</th>
            <th>
                <button type="button" class="btn btn-sm btn-primary" >
                    <a href="/index.php/goods/goods_add" alt="新增商品(New goods)" style="color:white;"><span class="bi-plus-lg"></span></a>
                </button>                
            </th>
        </thead>
        <tbody>
            {foreach $list['data'] as $k=>$kv}
            <tr>
                <td>{$k+1}</td>
                <td class="long_field">{$kv['name']}</td>
                <td><c>{$kv['price']}</c></td>
                <td><c>{$kv['price1']}</c></td>
                <td><img class="goods_image" src="{$kv['image'][0]}" style="width:40px;border:1px solid #ccc;" /></td>
                <td>{$kv['creater_name']}</td>
                <td>{$kv['create_time']|date='Y-m-d H:i:s'}</td>
                {if $kv['status']==1}
                    <td>{$kv['status_name']}</td>
                {else if $kv['status']==2}
                    <td style="text-decoration:line-through;color:red;">{$kv['status_name']}</td>
                {/if}
                <td>
                    <a href="/index.php/goods/edit/id/{$kv['id']}">
                        <button tyle="button" class="btn btn-sm btn-info"><span class="bi-pencil"></span></button>
                    </a>
                </td>
            </tr>
            {/foreach}
        
        </tbody>    
    </table>



     
</div>

</body>

<script type="text/javascript">
  $(document).ready(function(){    
    //显示图片



    $(".query").on('click',function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
        var cid = $("#customer_id").val();
        var order_no = $("#order_no").val();
        var sdate = $("#sdate").val();
        var edate = $("#edate").val();

        $("form").submit();
        layer.close(index);
    })

    $(".goods_image").on('click',function(){
        var img = $(this).attr('src');
        if(!img.trim()) return;

        layer.open({
          type: 1,
          title:'',
          closeBtn: 0, //不显示关闭按钮
         // anim: 1,
          time: 5*1000,
          shadeClose: true, //开启遮罩关闭              
          skin: 'layui-layer-rim', 
          content: "<img src='"+img+"' style='width:100%'>"
        });
    })
})
</script>


</body>
</html>
